import { BaseProvider } from "./BaseProvider";

export default class SingletonProvider extends BaseProvider {
    private _clazzKey: string = null;

    constructor(clazz) {
        super();
        this._clazzKey = clazz
    }

    public getEntity(...args: any[]) {
        if (!this._entity) {
            this._entity = this._injector.instantiateOf(this._clazzKey, ...args);
        }
        return this._entity;
    }
}